home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr18
/
sub40.zip
/
SUB.PRG
< prev
next >
Wrap
Text File
|
1993-06-01
|
2KB
|
66 lines
* SUB.PRG written by Michael MacDonald. (c)1993 Revised 2/13/93
*
IF ISCOLOR()
SET COLOR TO W/B
ENDIF
pext1=""
pext2=""
PARAMETERS pext1,pext2
SET TALK OFF
SET CONFIRM OFF
SET CURSOR OFF
CLEAR
@ 1,22 SAY "SUB v4.0 by Michael MacDonald (c)1993"
@ 2,5 SAY "A program to replace the file extensions in ROBOCOMM's new files list"
@ 4,5 SAY "░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░"
num=0
count=0
DO CASE
CASE FILE("new40.dbf")
USE new40
@ 6,5 SAY "Using NEW40.DBF"
CASE FILE("new50.dbf")
USE new50
@ 6,5 SAY "Using NEW50.DBF"
OTHERWISE
@ 6,5 SAY "Can't find NEWxx.DBF"
?
SET CURSOR ON
QUIT
ENDCASE
ext=UPPER(RTRIM(pext1))
newext=UPPER(RTRIM(pext2))
IF ext="/?" .OR. ext="?"
@ 6,5 SAY "The correct syntax is SUB <ext to replace> <replacement>"
CLOSE ALL
SET CURSOR ON
QUIT
ENDIF
DO WHILE .NOT. EOF()
msize=RECCOUNT()
@ 8,5 SAY "Searching for files with "+ext+" extensions"
num=num+1
line=INT((num/msize)*69)
IF line>0
@ 4,4+line SAY "█"
ENDIF
IF msize < 68 .AND. line < 68
@ 4,5+line SAY "█"
ENDIF
pos=AT(".",file_name)
IF UPPER(SUBSTR(file_name,(pos+1),3))=ext
oldfile=file_name
file=STUFF(file_name,(pos+1),3,newext)
REPL file_name WITH FILE
count=count+1
@ 9,5 SAY "Renaming -->"+oldfile+" to "+FILE
ENDIF
SKIP
ENDDO
@ 10,5 SAY "Renamed "+LTRIM(STR(count))+" files"
CLOSE ALL
SET CURSOR ON
QUIT
*
* EOF SUB.PRG